<template>
  <div class="list-box">
    <div class="box">
      <div class="top">
        <router-link to="/Position">
          <span class="iconfont icon-arrow-left"></span>
        </router-link>

        <span class="title">{{ this.array.title }}</span>
      </div>
      <ul>
        <li v-for="item in this.array.data" :key="item.id">
          <p class="Ptitle">{{ item.ppp }}</p>
          <p class="neirong">
            {{ item.company }} <span class="biaoji">{{ item.buxian }}</span>
            <span class="price">{{ item.price }}</span>
          </p>

          <div class="san">
            <span class="tiaojian">{{ item.dayP }}</span>
            <span class="tiaojian">{{ item.dayT }}</span>
            <span class="tiaojian">{{ item.sexTiaojian }}</span>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";

export default {
  name: "List",
  data() {
    return {
      title: "",
      array: [],
      // 前面传过来的index
      index:this.$route.query.nextIndex
    };
  },
  created() {
    axios
      // .get(`http://localhost:3000/${this.$route.query.index}`)
      // .get("/list")
      .get("http://localhost:3000/list")
      .then((res) => {
        // console.log(res.data);
        this.array=res.data[this.index];
        // console.log(this.array);
      })
      .catch((err) => {
        console.error(err);
      });
  },
};
</script>

<style  scoped>
.top {
  margin-top: 0.1rem;
}
.icon-arrow-left {
  font-size: 0.28rem;
  margin-left: 0.1rem;
  font-weight: 700;
}
.title {
  font-size: 0.26rem;
  margin-left: 0.9rem;
}

.list-box ul {
  display: flex;
  flex-direction: column;
  margin-top: 0.2rem;
  margin-left: 0.1rem;
  margin-right: 0.1rem;
}

.list-box ul li {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #8e8e8e;
  margin-bottom: .1rem;
}

.list-box ul li .Ptitle {
  font-size: 0.2rem;
  line-height: 0.4rem;
}

.list-box ul li .biaoji {
  color: #bfbfbf;
  font-size: 0.12rem;
  line-height: 0.4rem;
}

.list-box ul li .san {
  color: #8db7d9;
  line-height: 0.5rem;
}

.list-box ul li .tiaojian:first-child {
  margin-left: 0;
}

.list-box ul li .tiaojian {
  margin-left: 0.3rem;
}

.list-box ul li .price {
  float: right;
  margin-right: 0.1rem;
}
</style>

